<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="module:user:add">
				<i class="fa fa-plus"></i> 添加
			</a> -->
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="module:user:edit">
	            <i class="fa fa-edit"></i> 修改
	        </a>
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="module:user:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('user:edit')}]];
        var removeFlag = [[${@permission.hasPermi('user:remove')}]];
        var prefix = ctx + "user";
        var sexs = [[${@dict.getType('sys_user_sex')}]];
        var accountStatus = [[${@dict.getType('app_account_status')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "APP用户",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '' 
				},
				{
					field : 'account', 
					title : '登录账号' 
				},
				{
					field : 'phone', 
					title : '手机号码' 
				},
				/* {
					field : 'name', 
					title : '真实姓名' 
				}, */
				{
					field : 'nickName', 
					title : '昵称' 
				},
				{
					field : 'sex', 
					title : '性别',
					formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(sexs, value);
		            }
				},
				{
					field : 'birthday', 
					title : '出生日期' 
				},
				/* {
					field : 'headPic', 
					title : '头像' 
				}, */
				/* {
					field : 'bloodVal', 
					title : '血压值' 
				},
				{
					field : 'stepGoal', 
					title : '目标步数' 
				},
				{
					field : 'sleepGoal', 
					title : '睡眠指标（分钟）' 
				},
				{
					field : 'height', 
					title : '身高（CM）' 
				},
				{
					field : 'weight', 
					title : '体重（KG）' 
				},
				{
					field : 'bloodType', 
					title : '血型' 
				}, */
				/* {
					field : 'medicalHistory', 
					title : '病史' 
				},
				{
					field : 'password', 
					title : '密码' 
				}, */
				{
					field : 'status', 
					title : '账号状态',
					formatter: function(value, row, index) {
		            	return $.table.selectDictLabel(accountStatus, value);
		            }
				},
				/* {
					field : 'createBy', 
					title : '创建者' 
				},
				{
					field : 'createTime', 
					title : '创建时间' 
				},
				{
					field : 'updateBy', 
					title : '更新者' 
				},
				{
					field : 'updateTime', 
					title : '更新时间' 
				},
				{
					field : 'enabled', 
					title : '假删除（0-正常，1-删除）' 
				}, */
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>